Linear Parsing Expression Grammars

نویسندگان

  • Nariyoshi Chida
  • Kimio Kuramitsu
چکیده

PEGs were formalized by Ford in 2004, and have several pragmatic operators (such as ordered choice and unlimited lookahead) for better expressing modern programming language syntax. Since these operators are not explicitly defined in the classic formal language theory, it is significant and still challenging to argue PEGs’ expressiveness in the context of formal language theory. Since PEGs are relatively new, there are several unsolved problems. One of the problems is revealing a subclass of PEGs that is equivalent to DFAs. This allows application of some techniques from the theory of regular grammar to PEGs. In this paper, we define Linear PEGs (LPEGs), a subclass of PEGs that is equivalent to DFAs. Surprisingly, LPEGs are formalized by only excluding some patterns of recursive nonterminal in PEGs, and include the full set of ordered choice, unlimited lookahead, and greedy repetition, which are characteristic of PEGs. Although the conversion judgement of parsing expressions into DFAs is undecidable in general, the formalism of LPEGs allows for a syntactical judgement of parsing expressions.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Structured Grammars are Effective

Top-down parsing has received much attention recently. Parsing expression grammars (PEG) allows construction of linear time parsers using packrat algorithm. These techniques however suffer from problem of prefix hiding. We use alternative formalism of relativized regular expressions REG REG for which top-down backtracking parser runs in linear time. This formalism allows to construct fast parse...

متن کامل

Derivatives of Parsing Expression Grammars

This paper introduces a new memoized derivative parsing algorithm for recognition of parsing expression grammars. The algorithm runs in worst case quartic time and cubic space. However, existing research suggests that due to the limited amount of backtracking and recursion in realworld grammars and input, practical performance may be closer to linear time and constant space; experimental valida...

متن کامل

Stream Processing using Grammars and Regular Expressions

In this dissertation we study expression based parsing and the use of grammatical specifications for the synthesis of fast, streaming stringprocessing programs. In the first part we develop two linear-time algorithms for regular expression based parsing with Perl-style greedy disambiguation. The first algorithm operates in two passes in a semi-streaming fashion, using a constant amount of worki...

متن کامل

Using Linear Positional Grammars for the LR Parsing of 2-D Symbolic Languages

In this paper we present a grammar formalism for the generation and parsing of two-dimensional symbolic languages. Linear Positional Grammars (or LPGs for short) are an immediate generalization of the context-free string grammars. Through the use of general spatial relations they allow the definition of pictures whose symbols span on a two-dimensional space. Due to their analogy to context-free...

متن کامل

On the Relation between Context-Free Grammars and Parsing Expression Grammars

Context-Free Grammars (CFGs) and Parsing Expression Grammars (PEGs) have several similarities and a few differences in both their syntax and semantics, but they are usually presented through formalisms that hinder a proper comparison. In this paper we present a new formalism for CFGs that highlights the similarities and differences between them. The new formalism borrows from PEGs the use of pa...

متن کامل

XML schema validation using parsing expression grammars

Schema validation is an integral part of reliable information exchange on the Web. However, implementing an efficient schema validation tool is not easy. We highlight the use of parsing expression grammars (PEGs), a recognition-based foundation for describing syntax, and apply it to the XML/DTD validation. This paper shows that structural schema constraints in document type definitions (DTDs) c...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2017